package zust.study.blockchain.demo;

import java.util.Set;

/**
 * @author senselyan
 * @Description: ${todo}
 * @date 2018/3/19 15:59
 */
public class Block {

    /** 区块的序号 */
    private Long index;

    /** 区块产生的时间 */
    private Long timestamp;

    /** 区块对应哪些交易 */
    private Set<Transaction> transactions;

    /** 工作证明 */
    private Long proof;

    /** 上一个区块的hash */
    private String previousHash;

    
    
    public Long getIndex() {
        return index;
    }

    public void setIndex(Long index) {
        this.index = index;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public Set<Transaction> getTransactions() {
        return transactions;
    }

    public void setTransactions(Set<Transaction> transactions) {
        this.transactions = transactions;
    }

    public Long getProof() {
        return proof;
    }

    public void setProof(Long proof) {
        this.proof = proof;
    }

    public String getPreviousHash() {
        return previousHash;
    }

    public void setPreviousHash(String previousHash) {
        this.previousHash = previousHash;
    }

    @Override
    public String toString() {
        return "{\"Block\":{"
                + "                        \"index\":\"" + index + "\""
                + ",                         \"timestamp\":\"" + timestamp + "\""
                + ",                         \"transactions\":" + transactions
                + ",                         \"proof\":\"" + proof + "\""
                + ",                         \"previousHash\":\"" + previousHash + "\""
                + "}}";
    }

}
